
import Api from '@/database'
import { defineWrappedResponseHandler } from '../utils/handler'

const handler = defineEventHandler(async (e) => {
  const { table, data, where } = await readBody(e)
  data['updatedAt'] = new Date().toISOString()
  return await Api.crud.update(table, where, data)
})

export default defineWrappedResponseHandler(handler)